﻿//using System;
//using System.Collections.ObjectModel;
//using System.ComponentModel;
//using System.Linq;
//using System.Collections.Generic;
//using System.Windows.Data;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
//using Northwind.Model;
//using Northwind.Application;
//using Rhino.Mocks;

//namespace Northwind.ViewModel.Tests
//{
//    [TestClass]
//    public class MainWindowViewModelTests
//    {
//        [TestMethod]
//        public void Customers_Always_CallsGetCustomers()
//        {
//            // Arrange
//            IUIDataProvider uiDataProviderMock
//                = MockRepository
//                    .GenerateMock<IUIDataProvider>();
//            uiDataProviderMock.Expect(c => c.GetCustomers());

//            // Act
//            MainWindowViewModel target
//                = new MainWindowViewModel(uiDataProviderMock);
//            IList<Customer> customers = target.Customers;

//            // Assert
//            uiDataProviderMock.VerifyAllExpectations();
//        }

//        [ExpectedException(typeof (InvalidOperationException))]
//        [TestMethod]
//        public void
//            ShowCustomerDetails_SelectedCustomerIDIsNull_ThrowsInvalidOperationException
//            ()
//        {
//            // Arrange
//            MainWindowViewModel target
//                = new MainWindowViewModel(null);

//            // Act
//            target.ShowCustomerDetails();
//        }

//        [TestMethod]
//        public void ShowCustomerDetails_ToolNotFound_AddToolCalled()
//        {
//            // Arrange
//            const string expectedCustomerID = "EXPECTEDID";
//            IToolManger toolManagerMock
//                = MockRepository
//                    .GenerateMock<IToolManger>();
//            toolManagerMock.Stub(t => t.Tools).Return( 
//                new ObservableCollection<ToolViewModel>());
//            toolManagerMock
//                .Expect(t => t.OpenTool(Arg<CustomerDetailsViewModel>.Is.Anything));
//            MainWindowViewModel target =
//                GetShowCustomerDetailsTarget(
//                    new Customer 
//                        { CustomerID = expectedCustomerID},
//                        toolManagerMock);

//            // Act
//            target.ShowCustomerDetails();

//            toolManagerMock.VerifyAllExpectations();
//        }

//        private static MainWindowViewModel
//            GetShowCustomerDetailsTarget(
//                Customer customer,
//                IToolManger toolMangerFake = null,
//                ICustomerDetailsViewModelFactory
//                    customerDetailsViewModelFactory = null
//            )
//        {
//            IUIDataProvider uiDataProviderStub
//                = MockRepository
//                    .GenerateStub<IUIDataProvider>();
//            MainWindowViewModel target
//                = new MainWindowViewModel(uiDataProviderStub, 
//                    toolMangerFake,
//                    customerDetailsViewModelFactory
//                    );
//            target.SelectedCustomerID = customer.CustomerID;
//            uiDataProviderStub.Stub(
//                d => d.GetCustomer(customer.CustomerID)).Return(
//                    customer);
//            return target;
//        }
//    }
//}